package com.sopaths.web.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.sopaths.utility.web.WebUtil;

//@Named("lastPageRecordingInterceptor")
public class LastPageRecordingInterceptor extends HandlerInterceptorAdapter {

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) {
		String uri = request.getRequestURI();
		if (uri.startsWith(request.getContextPath() + "/connect/login") ||
			uri.startsWith(request.getContextPath() + "/resources")) {
			return;
		} else {
			WebUtil.saveLastPageURI(uri);
		}
	}
}
